<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/style/css/pageCommon.css" />
    <script language="javascript" src="${pageContext.request.contextPath}/script/jquery.js"></script>
    <script language="javascript" src="${pageContext.request.contextPath}/script/commonUtils.js" charset="utf-8"></script>
    <script type="text/javascript">
    </script>
</head>
<style>
td{
 height:25px;
}
</style>
<script type="text/javascript">
var memberId='${memberId}';
var sessionId = '${sessionId}';
$(function(){
	loadMemberInfo();
});


function loadMemberInfo(){
	var param={
			memberId:memberId,
			"method":"getMemberById"
			};
	var url="${pageContext.request.contextPath}/common/commonController?sessionId="+sessionId;
	$.ajax({
	    url : url,
	    type : "POST",
	    async : true,
	    contentType: "application/json; charset=utf-8",
	    data : JSON.stringify(param),
	    dataType : 'json',
	    success : function(data) {
	    	if(data.resultCode=="000000"){
	    		var member=data.data;
	    		member.memberId=member.id;
	    		$.each($("input").not($("input[type='radio']")),function(n,v){
	    			var name=$(v).attr("name");
	    			var value=member[name];
	    			$(v).val(value);
	    		});
	    		$("select[name='isBlack'] option[value='"+member.isBlack+"']").attr("selected", true);
	    		$("select[name='isAdmin'] option[value='"+member.isAdmin+"']").attr("selected", true);
	    		$("select[name='isCharge'] option[value='"+member.isCharge+"']").attr("selected", true);
	    	}else{
	    		alert(data.resultMsg)
	    	}
	    }
	});
	
}

function update(){
	var isBlack=$("select[name='isBlack']").find('option:selected').val();
	var isAdmin=$("select[name='isAdmin']").find('option:selected').val();
	var isCharge=$("select[name='isCharge']").find('option:selected').val();
	var balance=$("input[name='balance']").val();
	var param={
			memberId:memberId,
			isBlack:isBlack,
			isAdmin:isAdmin,
			isCharge:isCharge,
			balance:balance,
			"method":"modifyMember2"
			};
	var url="${pageContext.request.contextPath}/common/commonController?sessionId="+sessionId;
	$.ajax({
	    url : url,
	    type : "POST",
	    async : true,
	    contentType: "application/json; charset=utf-8",
	    data : JSON.stringify(param),
	    dataType : 'json',
	    success : function(data) {
	    	if(data.resultCode=="000000"){
	    		alert("修改成功");
	    		window.history.back(-1); 
	    	}else{
	    		alert(data.resultMsg)
	    	}
	    }
	});
	return false;
}

function goBack(){
	window.history.go(-1);
}

</script>
<body>

<div id="Title_bar">
    <div id="Title_bar_Head">
        <div id="Title_Head"></div>
        <div id="Title">
            <img border="0" width="13" height="13" src="${pageContext.request.contextPath}/style/images/title_arrow.gif"/> 会员信息修改
        </div>
        <div id="Title_End"></div>
    </div>
</div>

<div style="padding-left: 10px;">
       <div class="ItemBlock_Title1"><div class="ItemBlock_Title1">
        	<img border="0" width="4" height="7" src="${pageContext.request.contextPath}/style/images/item_point.gif" /> 会员信息修改 </div> 
        </div>
        
        
          <div class="ItemBlockBorder">
            <div class="ItemBlock">
                <table cellpadding="0" cellspacing="0" class="mainForm">
					<tr>
                        <td>会员号</td>
                        <td><input type="text" name="memberId" disabled="disabled"></input></td>
                        <td>昵称</td>
                        <td><input type="text" name="nickName" disabled="disabled"></input> </td>
                    </tr>

                    <tr>
                        <td>是否黑名单</td>
                        <td>
                       		 <select name="isBlack" >
                                <option value="" selected="selected">请选择</option>
                                <option value="0">否</option>
                                <option value="1">是</option>
                            </select>
                         </td>
                        <td>是否管理员</td>
                        <td>
                       		 <select name="isAdmin" >
                                <option value="" selected="selected">请选择</option>
                                <option value="0">否</option>
                                <option value="1">是</option>
                            </select>
                         </td>
                    </tr>
                    <tr>
                        <td>是否付费</td>
                        <td>
                       		 <select name="isCharge" >
                                <option value="" selected="selected">请选择</option>
                                <option value="0">否</option>
                                <option value="1">会员付费</option>
                                <option value="2">服务付费</option>
                            </select>
                         </td>
                         <td>余额</td>
                        <td><input type="text" name="balance"></input> </td>
                    </tr>
                  
                </table>
            </div>
        </div>
        
         <div id="InputDetailBar" style="float: left">
            <input type="image" src="${pageContext.request.contextPath}/style/images/button/save.png"  onclick="return update();" />
            <input type="image" src="${pageContext.request.contextPath}/style/images/button/goBack.png""  onclick="goBack(1)" />
        </div>
        
        
        
   </div>

</body>
</html>
